/**
 * Company : Thai Informatic System Co., Ltd.
 * Created By : Dr.Tree
 * Created On : Mar 12, 2012  12:49:01 PM 
 * e-Mail : chatree@tis.co.th
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : jpa.service.promis.construction
 * File Name : VwSyncGrtItemServices.java
 * TODO
 */
package jpa.service.promis.construction;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import org.apache.log4j.Logger;
import promis.utility.CommonService;
import jpa.entitys.promis.construction.VwSyncGrtItem;
import jpa.service.common.JPAService;

/**
 * @author chatree
 *
 */
public class VwSyncGrtItemServices extends JPAService {
	
	
	private static final Logger log = Logger.getLogger(VwSyncGrtItemServices.class);

	/**
	 * @param em
	 */
	public VwSyncGrtItemServices(EntityManager em) {
		super(em);
		// TODO Auto-generated constructor stub
	}
	
	
	public VwSyncGrtItem findById(String id) throws Exception {		
	
		return super.ConvertToYoureObject(super.find(id, "VwSyncGrtItem.findById"));				
	}
	
	public List<VwSyncGrtItem> findAll() throws Exception {
		return super.ConvertToYoureObject(super.findAll("VwSyncGrtItem.findAll"));
	}

	public List<VwSyncGrtItem> findByDocumentNo(String company, String project ,String documentNo, String status, String syncIsstaging) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("company", company);
		mapWhereValue.put("project", project);
		mapWhereValue.put("documentNo", documentNo);
		mapWhereValue.put("status", status);
		mapWhereValue.put("syncIsstaging", syncIsstaging);
		
		return super.ConvertToYoureObject(super.find("VwSyncGrtItem.findByDocumentNo", mapWhereValue));
		
	}

}
